﻿///////////////////////////////////////////////////////////////////////////////
// 文件名： Scene.hpp
// 作者：   671643387@qq.com
// 日期：   2015年11月1日 下午6:39:03
// 简介：   
///////////////////////////////////////////////////////////////////////////////

#if !defined(GRAPHICS_GRAPHICS_SCENE_HPP_)
#define GRAPHICS_GRAPHICS_SCENE_HPP_

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif

#include <vector>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>

#include <graphics/graphics/SceneNode.hpp>
#include <graphics/graphics/scenenode/Camera.hpp>
#include <graphics/graphics/scenenode/GraphicsNode.hpp>

namespace graphics
{
    namespace graphics
    {
        namespace render
        {
            class Render;
        }

        class Scene : public boost::noncopyable
        {
        public:
            Scene(void);
            ~Scene(void);

        public:
            void SetRender(::graphics::graphics::render::Render* render);
            ::graphics::graphics::render::Render* GetRender(void) const;
            void RenderFrame(void);

            void AddCamera(::graphics::graphics::scenenode::CameraPtr camera);
            void RemoveCamera(int id);
            ::graphics::graphics::scenenode::CameraPtr GetCamera(int id);

            void AddGraphicsNode(::graphics::graphics::scenenode::GraphicsNodePtr node);
            void RemoveGraphicsNode(::graphics::graphics::scenenode::GraphicsNode* node);

        private:
            void RenderGraphicsNodes_(::graphics::graphics::scenenode::CameraPtr& camera);

        protected:
            typedef std::vector<::graphics::graphics::scenenode::CameraPtr> CameraArray;
            typedef std::vector<::graphics::graphics::scenenode::GraphicsNodePtr> GraphicsNodeArray;

        protected:
            ::graphics::graphics::render::Render* render_;

            CameraArray cameras_;
            GraphicsNodeArray graphicsNodes_;
        };

        typedef boost::shared_ptr<Scene>    ScenePtr;
    }
}

#endif //GRAPHICS_GRAPHICS_SCENE_HPP_
